<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qsggeometry.cpp -->
  <title>Attribute 类 | Qt Quick 5.12.3</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.12</a></td><td ><a href="qtquick-index.html">Qt Quick 模块</a></td><td ><a href="qtquick-module.html">C++ 类</a></td><td >Attribute</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtquick-index.html">Qt 5.12.3 参考指南</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">目录</a></h3>
<ul>
<li class="level1"><a href="#public-variables">Public Variables</a></li>
<li class="level1"><a href="#static-public-members">静态公用成员</a></li>
<li class="level1"><a href="#details">详细信息</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Attribute 类</h1>
<span class="small-subtitle">(<a href="qsggeometry-attribute.html">QSGGeometry::Attribute</a>)<br/></span>
<!-- $$$Attribute-brief -->
<p>The <a href="qsggeometry-attribute.html">QSGGeometry::Attribute</a> describes a single vertex attribute in a <a href="qsggeometry.html">QSGGeometry</a>. <a href="#details">更多...</a></p>
<!-- @@@Attribute -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign">头文件：</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;Attribute&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += quick</td></tr></table></div><ul>
<li><a href="qsggeometry-attribute-members.html">所有成员的列表，包括继承成员</a></li>
</ul>
<a name="public-variables"></a>
<h2 id="public-variables">Public Variables</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QSGGeometry::AttributeType </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry-attribute.html#attributeType-var">attributeType</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> uint </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry-attribute.html#isVertexCoordinate-var">isVertexCoordinate</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry-attribute.html#position-var">position</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> uint </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry-attribute.html#reserved-var">reserved</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry-attribute.html#tupleSize-var">tupleSize</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry-attribute.html#type-var">type</a></b></td></tr>
</table></div>
<a name="static-public-members"></a>
<h2 id="static-public-members">静态公用成员</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Attribute </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry-attribute.html#create">create</a></b>(int <i>pos</i>, int <i>tupleSize</i>, int <i>primitiveType</i>, bool <i>isPosition</i> = false)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Attribute </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry-attribute.html#createWithAttributeType">createWithAttributeType</a></b>(int <i>pos</i>, int <i>tupleSize</i>, int <i>primitiveType</i>, AttributeType <i>attributeType</i>)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$Attribute-description -->
<div class="descr">
<h2 id="details">详细信息</h2>
<p>The <a href="qsggeometry-attribute.html">QSGGeometry::Attribute</a> describes a single vertex attribute in a <a href="qsggeometry.html">QSGGeometry</a>.</p>
<p>The <a href="qsggeometry-attribute.html">QSGGeometry::Attribute</a> struct describes the attribute register position, the size of the attribute tuple and the attribute type.</p>
<p>It also contains a hint to the renderer if this attribute is the attribute describing the position. The scene graph renderer may use this information to perform optimizations.</p>
<p>It contains a number of bits which are reserved for future use.</p>
</div>
<p><b>请参考 </b><a href="qsggeometry.html">QSGGeometry</a>。</p>
<!-- @@@Attribute -->
<div class="func">
<h2>成员函数文档</h2>
<!-- $$$create[overload1]$$$createintintintbool -->
<h3 class="fn" id="create"><a name="create"></a><code>[static] </code><span class="type"><a href="qsggeometry-attribute.html">Attribute</a></span> Attribute::<span class="name">create</span>(<span class="type">int</span> <i>pos</i>, <span class="type">int</span> <i>tupleSize</i>, <span class="type">int</span> <i>primitiveType</i>, <span class="type">bool</span> <i>isPosition</i> = false)</h3>
<p>Creates a new <a href="qsggeometry-attribute.html">QSGGeometry::Attribute</a> for attribute register <i>pos</i> with <i>tupleSize</i>. The <i>primitiveType</i> can be any of the supported types from <a href="qsggeometry.html#Type-enum">QSGGeometry::Type</a>, such as <a href="qsggeometry.html#Type-enum">QSGGeometry::FloatType</a> or <a href="qsggeometry.html#Type-enum">QSGGeometry::UnsignedByteType</a>.</p>
<p>If the attribute describes the position for the vertex, the <i>isPosition</i> hint should be set to <code>true</code>. The scene graph renderer may use this information to perform optimizations.</p>
<p><b>Note: </b>Scene graph backends for APIs other than OpenGL may require an accurate description of attributes' usage, and therefore it is recommended to use <a href="qsggeometry-attribute.html#createWithAttributeType">createWithAttributeType</a>() instead.</p><p>Use the create function to construct the attribute, rather than an initialization list, to ensure that all fields are initialized.</p>
<!-- @@@create -->
<!-- $$$createWithAttributeType[overload1]$$$createWithAttributeTypeintintintAttributeType -->
<h3 class="fn" id="createWithAttributeType"><a name="createWithAttributeType"></a><code>[static] </code><span class="type"><a href="qsggeometry-attribute.html">Attribute</a></span> Attribute::<span class="name">createWithAttributeType</span>(<span class="type">int</span> <i>pos</i>, <span class="type">int</span> <i>tupleSize</i>, <span class="type">int</span> <i>primitiveType</i>, <span class="type"><a href="qsggeometry.html#AttributeType-enum">AttributeType</a></span> <i>attributeType</i>)</h3>
<p>Creates a new <a href="qsggeometry-attribute.html">QSGGeometry::Attribute</a> for attribute register <i>pos</i> with <i>tupleSize</i>. The <i>primitiveType</i> can be any of the supported types from <a href="qsggeometry.html#Type-enum">QSGGeometry::Type</a>, such as <a href="qsggeometry.html#Type-enum">QSGGeometry::FloatType</a> or <a href="qsggeometry.html#Type-enum">QSGGeometry::UnsignedByteType</a>.</p>
<p><i>attributeType</i> describes the intended use of the attribute.</p>
<p>Use the create function to construct the attribute, rather than an initialization list, to ensure that all fields are initialized.</p>
<!-- @@@createWithAttributeType -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
